package com.bbx.taxi.client.Task;

import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;

import com.bbx.androidapi.util.SharedPreUtil;
import com.bbx.androidapi.util.ToastUtil;
import com.bbx.api.sdk.model.passanger.CancelOrder;
import com.bbx.api.sdk.model.passanger.CouponCountBuild;
import com.bbx.api.sdk.model.passanger.WeightOrVolumnBuild;
import com.bbx.api.sdk.net.base.BaseNetwork;
import com.bbx.api.sdk.net.base.JsonBuild;
import com.bbx.api.sdk.net.passeger.conn.CancelOrderNet;
import com.bbx.api.sdk.net.passeger.conn.CancelReasonListNet;
import com.bbx.api.sdk.net.passeger.conn.CouponCountNet;
import com.bbx.api.sdk.net.passeger.conn.WeightNet;
import com.bbx.taxi.client.Bean.Message.ObserverListener;
import com.bbx.taxi.client.Bean.Message.ObserverListener.DATA_TYPE;
import com.bbx.taxi.client.Task.BaseAsyncTask;
import com.bbx.api.util.SharedPreEncryptUtil;
import com.bbx.taxi.client.MyApplication;
import com.bbx.taxi.client.R;
/** 
 * @Path com.bbx.taxi.client.Task.MyCancelTask.java
 * @Author 严旭文
 * @Date 2016-6-12 下午1:57:34
 * @Company 蓝海（福建）信息技术有限公司
 * @Description
 * 取消订单
 */
public class MyCancelTask extends BaseTask{
    public DATA_TYPE TYPE=DATA_TYPE.CANCEL;
    private CancelOrder mCancelOrder;
	public MyCancelTask(Activity context,String order_id) {
		super(context);
		mCancelOrder = new CancelOrder(context);
		mCancelOrder.uid =  MyApplication.getInstance().getUid();
		mCancelOrder.access_token = MyApplication.getInstance().getToken();
		mCancelOrder.order_id = order_id;
		mCancelOrder.reason = "";
		mCancelOrder.reason_type = 0;
	}
	@Override
	public boolean isShow() {
		return true;
	}

	@Override
	public boolean isReturnString() {
		return true;
	}
	@Override
	public boolean condition() {
		// TODO Auto-generated method stub
		return true;
	}
	@Override
	public void request() {
		setType(TYPE,mCancelOrder);
	}
	@Override
	public void success(int status,Object object) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void failed(int status, String msg,String message) {
		if(status==-10121){
			mPublisher.publishdata(ObserverListener.DATA_STATUS.SUCCESS, TYPE,status, null);
		}else{
			if (status == -10120) {
				ToastUtil.showToast(context, message);
			} else {
				ToastUtil.showToast(context,
						context.getResources().getString(R.string.no_network));
			}

		}
	
	}
	@Override
	public BaseNetwork getBaseNetwork() {
		return new CancelOrderNet(context);
	}
}
